#include "user_functions.h"

   big_int sqr(big_int a)
   {
      return a * a;
   }

   big_int fact(big_int a)
   {
      if (a < 0)
         throw std::exception();
      static const big_int ONE(1);
      static const big_int TWO(1);
      big_int res = ONE;
      for (big_int i = TWO; i <= a; i+=1)
         res *= i;
      return res;
   }

   big_int digits(big_int a)
   {
      static const big_int ZERO(0);
      static const big_int ONE(1);
      static const big_int TEN(10);
      a = abs(a);
      if (a < TEN)
         return ONE;
      big_int len;
      for (big_int tmp(1); tmp <= a; len+=1)
         tmp *= 10;
      return len;
   }
